﻿CREATE TABLE [dbo].[TemplateScores] (
    [Id]           INT            IDENTITY (1, 1) NOT NULL,
    [Index]        INT            NOT NULL,
    [Date]         DATETIME       NOT NULL,
    [Local]        NVARCHAR (MAX) NOT NULL,
    [LocalGoals]   INT            NOT NULL,
    [Visitor]      NVARCHAR (MAX) NOT NULL,
    [VisitorGoals] INT            NOT NULL,
    [TemplateId]   INT            NOT NULL,
    [Image]        NVARCHAR (MAX) NOT NULL,
    [Location]     NVARCHAR (MAX) NOT NULL,
    CONSTRAINT [PK_TemplateScores] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_TemplateTemplateScore] FOREIGN KEY ([TemplateId]) REFERENCES [dbo].[Templates] ([Id])
);


GO
CREATE NONCLUSTERED INDEX [IX_FK_TemplateTemplateScore]
    ON [dbo].[TemplateScores]([TemplateId] ASC);

